
package cn.hz.horse.ext;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
 

import cn.hz.horse.EzHandle;

public class MyHandle extends EzHandle  {
 
	
	public boolean handle(Object obj){
	   
		//System.out.println("XXXXXX  "+obj);
		HashMap<String,Object> map=(HashMap<String,Object>)obj;
		boolean f=false;
		try{
			f=EsClient.put(map);
		}catch(Exception e){
			e.printStackTrace();
		}
		if(f){
			succQu.add(obj);
		}
		
		return true;
	}
	
	public boolean handleList(List<Object> list){
		//System.out.println("XXXXXX  "+obj);
		List<Map<String,Object>> list2=new ArrayList<Map<String,Object> >();
		 
		for(Object k:list){
			HashMap<String,Object> bb=(HashMap<String,Object>)k;
			list2.add(bb);
		}
		boolean f=false;
		try{
				f=EsClient.puts(list2);
		}catch(Exception e){
				e.printStackTrace();
		}
		if(f){
			succQu.addAll(list);
		}
				
		return true;
	}
}
